home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / SDKs / Now Utilities Plug Ins 6.0 / API Stuff / Now Tabs Plug Ins ƒ / Clock Plug In ƒ / Main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-07  |  1.9 KB  |  82 lines  |  [TEXT/KAHL]

  1. // file name
  2. //
  3. // © 1996 Now Software, Inc
  4. // written by: hac
  5.  
  6. #include "Main.h"
  7.  
  8. pascal void main(PlugInInformation *plugInInformation)
  9. {
  10.     plugInInformation->version = kPlugInInformationVersionOne;
  11.     plugInInformation->plugInType = kTimePlugInType;
  12.     plugInInformation->PrepareMenu = &PrepareMenu;
  13.     plugInInformation->HandleMenuItemSelected = &HandleMenuItemSelected;
  14. }
  15.  
  16. pascal void PrepareMenu(InstantAccessInformation *information, short asPreview)
  17. {
  18.     Str255                    time;
  19.     Str255                    date;
  20.     MenuItemInformation        menuItem;
  21.     DateTimeRec                dtrp;
  22.     unsigned long            secs;
  23.  
  24.     GetDateTime(&secs);
  25.  
  26.     IUDateString(secs, abbrevDate, date);
  27.     IUTimeString(secs, 0, time);
  28.  
  29.     // add some spacing
  30.     BlockMove(", ", &date[date[0] + 1], 2);
  31.     date[0] += 2;
  32.  
  33.     // add time
  34.     BlockMove(&time[1], &date[date[0] + 1], time[0]);    
  35.     date[0] += time[0];
  36.  
  37.     BlockMove(date, menuItem.text, kMenuItemTextSize);
  38.  
  39.     // add a divider line above
  40.     // add the clock menu item    
  41.     menuItem.version = kMenuItemInformationVersionOne;
  42.     menuItem.classification = kMiscellaneousClassification;
  43.     menuItem.type = kDividerMenuItemType;
  44.     menuItem.id = 1;
  45.     menuItem.enabled = false;
  46.     menuItem.style = 0;
  47.     menuItem.mark = 0;
  48.     menuItem.hasSubMenu = FALSE;
  49.     menuItem.subMenu = nil;
  50.     menuItem.refCon = 0;
  51.     menuItem.owningPlugInType = kTimePlugInType;
  52.     
  53.     (*information->AddMenuItem)(&menuItem);
  54.  
  55.     // add the clock menu item    
  56.     menuItem.type = kTextMenuItemType;
  57.     menuItem.id = 2;
  58.     menuItem.enabled = true;
  59.     
  60.     (*information->AddMenuItem)(&menuItem);
  61.  
  62.     // add a divider line below our time piece - kDividerMenuItemType
  63.     menuItem.type = kDividerMenuItemType;
  64.     menuItem.id = 2;
  65.     menuItem.enabled = false;
  66.     
  67.     (*information->AddMenuItem)(&menuItem);
  68.  
  69. error:;
  70.  
  71. }
  72.  
  73. pascal void CleanUpAfterMenuSelect(InstantAccessInformation *information, short asPreview)
  74. {
  75.     //hmmmm....
  76. }
  77.  
  78. pascal void HandleMenuItemSelected(InstantAccessInformation *information, MenuItemInformation *menuItem)
  79. {
  80.     
  81. }
  82.